<template>
	<view class="content">
		<web-view v-if="signUrl" :src="signUrl" ref="webView" id="webViewSign"></web-view>
	</view>
</template>

<script>
	import { getLandlordContractSign } from '@/common/API/contract'
	export default {
		data() {
			return {
				id: '',
				signUrl: '',
				phone: ''
			}
		},
		onLoad(options) {
			this.id = options.id;
			this.phone = options.phone;
			this.getContractInfo();
		},
		onUnload(){
			var pages = getCurrentPages(); //当前页面栈
			if (pages.length > 1) {
				var beforePage = pages[pages.length - 1];
				beforePage.refreshIfNeeded = true;
			}
		},
		methods: {
			async getContractInfo(){
				let params = {
					contract_id: this.id,
					show_status: 7
				};
				uni.showLoading({
					title:'加载中...'
				});
				let res = await getLandlordContractSign(this.id, this.phone)
				if(res){
					this.signUrl = res;
					this.$nextTick(() => {
						uni.hideLoading();
					},1000);
				}
			},
			getParam(path, name) {
		        var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
		        if (reg.test(path))
		        return unescape(RegExp.$2.replace(/\+/g, " "));
		        return "";
			}
		}
	}
</script>

<style lang="scss" scoped>
.content {
	
}
</style>
